<?php namespace App\Http\Requests;
/**
 * Created by PhpStorm.
 * User: liandne
 * Date: 16/5/28
 * Time: 下午12:01
 */

use App\Http\Requests\Request;

class SignUpRequest extends Request {

	/**
	 * Determine if the user is authorized to make this request.
	 *
	 * @return bool
	 */
	public function authorize()
	{
		return true;
	}

	public function attributes()
	{
		return [
			'phone'                 => '手机号',
			'verify_code_for_phone' => '手机验证码'
		];
	}
	/**
	 * Get the validation rules that apply to the request.
	 *
	 * @return array
	 */
	public function rules()
	{
		return [
			'username'              => 'required_without_all:email,phone|alpha_dash|min:2|max:20',
			'email'                 => 'required_without_all:username,phone|email',
			'phone'                 => ['required_without_all:username,email', 'regex:/1\d{10}/'],
			'password'              => 'required|alpha_dash|min:6|max:16',
			'role'                  => 'Integer|between:0,2',
			'verify_code_for_phone' => 'required_with:phone|Integer|min:0|max:9999',
			'verify_code_for_email' => 'required_with:email|Integer|min:0|max:9999',
//			'geetest_challenge'     => 'required|String',
//			'geetest_validate'      => 'required|String',
//			'geetest_seccode'       => 'required|String',

		];
	}

}
